<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="app" tagdir="/WEB-INF/tags"%>
<app:page>
  <table class="table">
    <thead>
      <tr>
        <th>#</th>
        <th>Text 1</th>
        <th>Text 2</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      <c:forEach var="item" items="${page.items}">
        <tr>
          <td>${item.id}</td>
          <td>${item.text1}</td>
          <td>${item.text2}</td>
          <td>
            <form action="${pageContext.request.contextPath}/admin/entry" method="post">
              <a class="btn btn-xs btn-primary" href="${pageContext.request.contextPath}/admin/entry?edit=&id=${item.id}">edit</a>
              <input type="hidden" name="id" value="${item.id}" />
              <button type="submit" name="delete" value="delete" class="btn btn-xs btn-danger">delete</button>
            </form>
          </td>
        </tr>
      </c:forEach>
    </tbody>
  </table>
  <ul class="pager">
    <li class="previous ${empty(page.prevPageNum) ? 'disabled' : ''}">
      <a href="${pageContext.request.contextPath}/admin/entry?page=${page.prevPageNum}">Previous</a>
    </li>
    <li class="next ${empty(page.nextPageNum) ? 'disabled' : ''}">
      <a href="${pageContext.request.contextPath}/admin/entry?page=${page.nextPageNum}">Next</a>
    </li>
  </ul>
  <a class="btn btn-default" href="${pageContext.request.contextPath}/admin/entry?add=">add</a>
  <a class="btn btn-default" href="${pageContext.request.contextPath}/admin/entry?addAll=">add all</a>
</app:page>
